package cloud.dwz.api;

import cloud.dwz.service.AuthService;
import io.wit.tool.ToolClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/api")
public class AuthController{

    @Resource
    private AuthService authService;

    @PostMapping("/register")
    public void register(final HttpServletRequest request,final HttpServletResponse response){
        ToolClient.responseJson(authService.register(request),response);
    }

    @PostMapping("/authLogin")
    public void authLogin(final HttpServletRequest request,final HttpServletResponse response){
        ToolClient.responseJson(authService.authLogin(request),response);
    }
}